

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>块设备基础命令 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Ceph 块设备运维" href="../rbd-operations/" />
    <link rel="prev" title="Ceph 块设备" href="../" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 块设备</a> &raquo;</li>
        
      <li>块设备基础命令</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/rbd/rados-rbd-cmds.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">基本命令</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">创建一个块设备存储池</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">创建一个块设备用户</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id4">创建块设备映像</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id5">罗列块设备映像</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">检索映像信息</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id7">调整块设备映像尺寸</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id8">删除块设备映像</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id9">块设备映像的恢复</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-operations/">运维</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-integrations/">对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../man/">手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="id1">
<h1>块设备基础命令<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<p id="index-0"><code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令可用于创建、罗列、自查和删除块设备映像，也可克隆映像、创建快照、回滚快照、查看快照等等。 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令用法详情见
<a class="reference external" href="../../man/8/rbd/">RBD – 管理 RADOS 块设备映像</a>。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>要使用 Ceph 块设备命令，你必须有相应的集群访问权限。</p>
</div>
<div class="section" id="id2">
<h2>创建一个块设备存储池<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<ol class="arabic">
<li><p>在管理节点上，用 <code class="docutils literal notranslate"><span class="pre">ceph</span></code> 工具<a class="reference external" href="../../rados/operations/pools/#create-a-pool">创建一个存储池</a>。</p></li>
<li><p>在管理节点上，用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 工具初始化这个存储池以用于 RBD：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">pool</span> <span class="n">init</span> <span class="o">&lt;</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="o">&gt;</span>
</pre></div>
</div>
</li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>没指定存储池名字时， <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 工具会假设默认的是 rbd 。</p>
</div>
</div>
<div class="section" id="id3">
<h2>创建一个块设备用户<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<p>如果不指定用户名， <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令默认将使用 <code class="docutils literal notranslate"><span class="pre">admin</span></code> 用户 ID 访问 Ceph 集群。
这个 ID 有拥有集群的所有管理权限。可能的话，建议你用一个限制了权限的用户访问。</p>
<p>要 <a class="reference external" href="../../rados/operations/user-management#add-a-user">创建一个 Ceph 用户</a> ，用 <code class="docutils literal notranslate"><span class="pre">ceph</span></code> 命令加上 <code class="docutils literal notranslate"><span class="pre">auth</span> <span class="pre">get-or-create</span></code> 子命令、
用户名、监视器能力、和 OSD 能力：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">auth</span> <span class="n">get</span><span class="o">-</span><span class="ow">or</span><span class="o">-</span><span class="n">create</span> <span class="n">client</span><span class="o">.</span><span class="p">{</span><span class="n">ID</span><span class="p">}</span> <span class="n">mon</span> <span class="s1">&#39;profile rbd&#39;</span> <span class="n">osd</span> <span class="s1">&#39;profile {profile name} [pool={pool-name}][, profile ...]&#39;</span> <span class="n">mgr</span> <span class="s1">&#39;profile rbd [pool={pool-name}]&#39;</span>
</pre></div>
</div>
<p>例如，要创建一个名为 <code class="docutils literal notranslate"><span class="pre">qemu</span></code> 的用户 ID ，有 <code class="docutils literal notranslate"><span class="pre">vms</span></code> 存储池的读写权限、
和 <code class="docutils literal notranslate"><span class="pre">images</span></code> 存储池的只读权限，执行命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">auth</span> <span class="n">get</span><span class="o">-</span><span class="ow">or</span><span class="o">-</span><span class="n">create</span> <span class="n">client</span><span class="o">.</span><span class="n">qemu</span> <span class="n">mon</span> <span class="s1">&#39;profile rbd&#39;</span> <span class="n">osd</span> <span class="s1">&#39;profile rbd pool=vms, profile rbd-read-only pool=images&#39;</span> <span class="n">mgr</span> <span class="s1">&#39;profile rbd pool=images&#39;</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">auth</span> <span class="pre">get-or-create</span></code> 命令的输出是指定用户的密钥环，
可以写入 <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.client.{ID}.keyring</span></code> 。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>使用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 命令的时候可以用 <code class="docutils literal notranslate"><span class="pre">--id</span> <span class="pre">{id}</span></code> 可选参数指定用户 ID 。</p>
</div>
</div>
<div class="section" id="id4">
<h2>创建块设备映像<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<p>要想把块设备加入某节点，你得先在
<a class="reference internal" href="../../glossary/#term-7"><span class="xref std std-term">Ceph 存储集群</span></a>中创建一个映像。
创建一个块设备映像用下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">create</span> <span class="o">--</span><span class="n">size</span> <span class="p">{</span><span class="n">megabytes</span><span class="p">}</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如，要在 <code class="docutils literal notranslate"><span class="pre">swimmingpool</span></code> 存储池中创建一个名为 <code class="docutils literal notranslate"><span class="pre">bar</span></code> 、大小为 1GB 的映像，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">create</span> <span class="o">--</span><span class="n">size</span> <span class="mi">1024</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="n">bar</span>
</pre></div>
</div>
<p>如果创建映像时不指定存储池，它将使用默认的 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池。例如，下面的命令将默认在 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池中创建一个大小为 1GB 、名为 <code class="docutils literal notranslate"><span class="pre">foo</span></code> 的映像：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">create</span> <span class="o">--</span><span class="n">size</span> <span class="mi">1024</span> <span class="n">foo</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>指定此存储池前必须先创建它，详情见<a class="reference external" href="../../rados/operations/pools">存储池</a>。</p>
</div>
</div>
<div class="section" id="id5">
<h2>罗列块设备映像<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p>要罗列 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池中的块设备，用下列命令（即 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 是默认存储池名字）：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">ls</span>
</pre></div>
</div>
<p>用下列命令罗列某个特定存储池中的块设备，用存储池名字替换掉 <code class="docutils literal notranslate"><span class="pre">{poolname}</span></code> ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">ls</span> <span class="p">{</span><span class="n">poolname</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">ls</span> <span class="n">swimmingpool</span>
</pre></div>
</div>
<p>要罗列 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池内延期删除的块设备，用此命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">ls</span>
</pre></div>
</div>
<p>要罗列指定存储池内延期删除的块设备，用下列命令，需把
<code class="docutils literal notranslate"><span class="pre">{poolname}</span></code> 替换成这个存储池的名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">ls</span> <span class="p">{</span><span class="n">poolname</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">ls</span> <span class="n">swimmingpool</span>
</pre></div>
</div>
</div>
<div class="section" id="id6">
<h2>检索映像信息<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
<p>用下列命令检索某特定映像的信息，用 <code class="docutils literal notranslate"><span class="pre">{image-name}</span></code> 替换映像名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">info</span> <span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">info</span> <span class="n">foo</span>
</pre></div>
</div>
<p>用下列命令检索某存储池内一映像的信息，用 <code class="docutils literal notranslate"><span class="pre">{image-name}</span></code> 替换掉映像名字、用 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 替换掉存储池名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">info</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">info</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="n">bar</span>
</pre></div>
</div>
</div>
<div class="section" id="id7">
<h2>调整块设备映像尺寸<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="../../glossary/#term-16"><span class="xref std std-term">Ceph 块设备</span></a>映像是瘦接口设备，只有在你开始写入数据时它们才会占用物理空间。然而，它们都有最大容量，就是你设置的 <code class="docutils literal notranslate"><span class="pre">--size</span></code> 选项。
如果你想增加（或减小） Ceph 块设备映像的最大尺寸，用下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">resize</span> <span class="o">--</span><span class="n">size</span> <span class="mi">2048</span> <span class="n">foo</span> <span class="p">(</span><span class="n">to</span> <span class="n">increase</span><span class="p">)</span>
<span class="n">rbd</span> <span class="n">resize</span> <span class="o">--</span><span class="n">size</span> <span class="mi">2048</span> <span class="n">foo</span> <span class="o">--</span><span class="n">allow</span><span class="o">-</span><span class="n">shrink</span> <span class="p">(</span><span class="n">to</span> <span class="n">decrease</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="id8">
<h2>删除块设备映像<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h2>
<p>用下列命令删除块设备，用 <code class="docutils literal notranslate"><span class="pre">{image-name}</span></code> 替换映像名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">rm</span> <span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">rm</span> <span class="n">foo</span>
</pre></div>
</div>
<p>用下列命令从某存储池中删除一个块设备，用 <code class="docutils literal notranslate"><span class="pre">{image-name}</span></code> 替换要删除的映像名、用 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 替换存储池名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">rm</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">rm</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="n">bar</span>
</pre></div>
</div>
<p>要从某一存储池中延期删除一个块设备，执行下列命令，但需把
<code class="docutils literal notranslate"><span class="pre">{image-name}</span></code> 替换成要操作的映像名、把 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 替换成存储池的名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">mv</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">mv</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="n">bar</span>
</pre></div>
</div>
<p>要从某一存储池删除已延期的块设备，执行下列命令，但需把
<code class="docutils literal notranslate"><span class="pre">{image-id}</span></code> 替换成欲删除映像的 id 、把 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 替换成存储池的名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">rm</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="nb">id</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">rm</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="mi">2</span><span class="n">bf4474b0dc51</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>你可以把一个映像移入垃圾池，即便它有快照、或正在被克隆品引用着，但不能从垃圾池删掉。</p></li>
<li><p>你可以用 <em>–expires-at</em> 设置延期时间（默认为 <code class="docutils literal notranslate"><span class="pre">now</span></code> ），并且，它的延期时间没到的话是不能删除的，除非你用 <em>–force</em>
选项。</p></li>
</ul>
</div>
</div>
<div class="section" id="id9">
<h2>块设备映像的恢复<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h2>
<p>要恢复 rbd 存储池内的一个延期删除块设备，用下列命令，但需把
<code class="docutils literal notranslate"><span class="pre">{image-id}</span></code> 替换成那个映像的 id ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">restore</span> <span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="nb">id</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">restore</span> <span class="mi">2</span><span class="n">bf4474b0dc51</span>
</pre></div>
</div>
<p>要恢复指定存储池内的一个延期删除块设备，用下列命令，但需把
<code class="docutils literal notranslate"><span class="pre">{image-id}</span></code> 替换成映像的 id 、 <code class="docutils literal notranslate"><span class="pre">{pool-name}</span></code> 替换成存储池名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">restore</span> <span class="p">{</span><span class="n">pool</span><span class="o">-</span><span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">image</span><span class="o">-</span><span class="nb">id</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">restore</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="mi">2</span><span class="n">bf4474b0dc51</span>
</pre></div>
</div>
<p>在恢复时，你还可以加 <code class="docutils literal notranslate"><span class="pre">--image</span></code> 选项来重命名它。</p>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">trash</span> <span class="n">restore</span> <span class="n">swimmingpool</span><span class="o">/</span><span class="mi">2</span><span class="n">bf4474b0dc51</span> <span class="o">--</span><span class="n">image</span> <span class="n">new</span><span class="o">-</span><span class="n">name</span>
</pre></div>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../rbd-operations/" class="btn btn-neutral float-right" title="Ceph 块设备运维" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../" class="btn btn-neutral float-left" title="Ceph 块设备" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>